package deployr.cli;

import java.util.*;

import deployr.core.*;

public class ResponderFactory {

	private final Workspace workspace;
	private final Projects projects;

	public ResponderFactory(Workspace workspace, Projects projects) {
		this.workspace = workspace;
		this.projects = projects;
	}

	public Responder createResponder() {
		List<Responder> responders = new LinkedList<Responder>();
		responders.add(new CreateProjectResponder(workspace, projects));
		responders.add(new ReadProjectChecksumResponder(workspace, projects));
		responders.add(new UpdateProjectChecksumResponder(workspace, projects));
		responders.add(new CreateProjectEventResponder());
		responders.add(new CreateProjectUpdateResponder(workspace, projects));
		responders.add(new DeleteProjectUpdateResponder(workspace, projects));
		responders.add(new ReadUpdateChecksumResponder(workspace));
		responders.add(new UpdateUpdateChecksumResponder(workspace));
		responders.add(new ReadUpdateDiffResponder(workspace));
		responders.add(new UpdateUpdateDiffResponder(workspace));
		responders.add(new CreateUpdateFilesResponder());
		responders.add(new CreateUpdateFilesBytesResponder(workspace));
		responders.add(new CreateUpdateEventResponder());
		responders.add(new CreateUpdateWebappResponder(workspace, projects));
		responders.add(new CreateProjectWebppResponder(workspace, projects));
		responders.add(new CreateProjectWarResponder(workspace, projects));
		responders.add(new CreateUpdateWarResponder(workspace, projects));
		
		responders.add(new CreateContextResponder());
		responders.add(new DeleteContextResponder());
		
		responders.add(new ReadHeartbeatResponder());

		responders.add(new NotFoundResponder());
		
		return new ResponderChain(responders);
	}

}